package com.pro.service;

import com.pro.dao.TestDao;
import com.pro.domain.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private TestDao testDao;

    @Transactional
    public void save(Test test){
        for (int i = 0; i < 10; i++) {
            if(i==3){
                throw new RuntimeException("发生了异常");
            }
            testDao.insertTest(test);
        }

    }
}
